#pragma once
#include <string>
#include "RenderDeclaration.h"

class RenderObject
{
	friend ref class RenderObjectManager;
public:
	enum RenderObjectType
	{
		RenderSprite = 0,
	};
	
	virtual void Update(float frame_time) = 0;

	virtual bool PreRender(uint layer ,float zoffset = 0.f) = 0;

	uint uid;
	uint type;
protected:
	RenderObject();

	virtual void Render(Microsoft::WRL::ComPtr<ID3D11DeviceContext1> context) = 0;
};
struct b2Vec2;
class Sprite : public RenderObject
{
	friend ref class RenderObjectManager;
public:
	virtual void Update(float frame_time);

	virtual bool PreRender(uint layer, float zoffset = 0.f);

	virtual void SetPosition(const float2& position);

	virtual void SetPosition(const b2Vec2& position);

	virtual void SetTransform(const float2& positon, float rotation);

	virtual void SetScale(const float2& scale);
	
	virtual void SetRotation(float rotation);

	virtual void SetUV(const float2& uv);

	virtual void SetTexture(Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> view);
protected:
	Sprite();

	virtual void Render(Microsoft::WRL::ComPtr<ID3D11DeviceContext1> context) ;

private:
	float			m_zOffset;
	float2			m_position;
	float			m_rotation;
	float2			m_scale;
	float2			m_uv;

	Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> m_TextureView;

	Microsoft::WRL::ComPtr<ID3D11Buffer>             m_constantBufferSprite;

	SpriteConstantBuffer    						 m_constantBufferSpriteData;

	bool			m_needUpdateConstantBuffer;

	

};